home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-03
/
qbasicpg.zip
/
ARRAY.BAS
< prev
next >
Wrap
BASIC Source File
|
1991-06-29
|
2KB
|
49 lines
100 CLS
110 DIM A$(50), I(50)
120 OPEN "I", 1, "phone.dat"' OPENs EXAMPLE.FIL as a source file to be read
130 LOCATE 9, 28: PRINT "READING FROM": LOCATE 9, 45: PRINT "WRITING TO"
140 LOCATE 9, 45: PRINT "WRITING TO"
150 LOCATE 10, 29: PRINT "INPUT FILE"
160 LOCATE 10, 45: PRINT "OUTPUT FILE"
170 LOCATE 11, 29: PRINT "~~~~~~~~~~"
180 LOCATE 11, 45: PRINT "~~~~~~~~~~~"
190 ' Reads from INPUT file begin...
200 FOR I = 1 TO 50
210 LINE INPUT #1, A$(I): LOCATE 12, 33: PRINT USING "####"; I' Reads In A$, as indexed by I
220 IF EOF(1) GOTO 240 ' Detects End of File, Dropping out of reads if fewer than 50 Records are detected
230 NEXT I
240 M = I' Sets M equal to highest value of I that was read into the Array...
250 CLOSE ' Closes File Number 1
260 BEEP
270 ' Writes to OUTPUT file begin...
280 OPEN "O", 1, "EXAMPLE.OUT"' OPENS EXAMPLE.OUT to write to it
290 FOR I = 1 TO M
300 PRINT #1, A$(I): LOCATE 12, 47: PRINT USING "####"; I
310 NEXT I
320 CLOSE
330 ' Screen Display of Indexed Array begins... DISPLAYED FROM RAM!
340 BEEP
350 LOCATE 22, 25: PRINT "< Press ANY Key to Continue >"
360 I$ = INKEY$: IF I$ = "" THEN 360
370 CLS
380 FOR I = 1 TO M
390 L = I
400 IF I > 20 THEN L = I - 20
410 IF I > 40 THEN L = I - 40
420 LOCATE L, 1: PRINT A$(I): N = N + 1
430 IF N = 20 OR N = 40 THEN 440 ELSE GOTO 480
440 BEEP
450 LOCATE 22, 25: PRINT "< Press ANY Key to Continue >"
460 I$ = INKEY$: IF I$ = "" THEN 460
470 CLS
480 NEXT I
490 BEEP
500 LOCATE 22, 23: PRINT "< Want to See That Again (Y/N)? >"
510 I = 1: L = 0: N = 0
520 I$ = INKEY$: IF I$ = "" THEN 520' Waits for Keyboard Input...
530 IF I$ <> "Y" AND I$ <> "y" AND I$ <> "N" AND I$ <> "n" THEN 520' Edits Keyboard Input...
540 IF I$ = "Y" OR I$ = "y" THEN 370' If answer is yes then ARRAY is again displayed from RAM...
550 IF I$ = "N" OR I$ = "n" THEN 560' If answer is no, then program ends...
560 END